home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / source / docs / refex / ex56.pp < prev    next >
Encoding:
Text File  |  2000-01-01  |  530 b   |  28 lines

  1. Program Example56;
  2.  
  3. { Program to demonstrate the Seek function. }
  4.  
  5. Var 
  6.   F : File;
  7.   I,j : longint;
  8.   
  9. begin
  10.   { Create a file and fill it with data } 
  11.   Assign (F,'test.dat');
  12.   Rewrite(F); { Create file }
  13.   Close(f);   
  14.   FileMode:=2;
  15.   ReSet (F,Sizeof(i)); { Opened read/write }
  16.   For I:=0 to 10 do
  17.     BlockWrite (F,I,1);
  18.   { Go Back to the begining of the file }
  19.   Seek(F,0);
  20.   For I:=0 to 10 do
  21.     begin
  22.     BlockRead (F,J,1);
  23.     If J<>I then 
  24.       Writeln ('Error: expected ' ,i,', got ',j);
  25.     end;
  26.   Close (f);
  27. end.
  28.